from cibynet.model import utils


class Switch(utils.ObjectHavingIp):
  """Switch Object.
  """
  
  def __init__(self, hostname, ip, manageable=True):
    """
    Arguments:
      - hostname: string, the name of the switch
      - ip: string, the ip of the switch
      - manageable: boolean, default True.
    """
    super(Switch, self).__init__()
    self.hostname = hostname
    if manageable:
      self.ip = ip
    self.manageable = manageable
    
  def __repr__(self):
    """
    """
    return "<Switch %s>" % self.hostname
  
  
  
class SwitchPort(object):
  """One port of a switch, assigned to one room.
  """
  
  def __init__(self, switch, number, room=None):
    """
    Arguments:
      - switch: switch object to which belongs the port.
      - number: the number of the port.
      - room: Room Object, eventually none if the port is not plugged to a room.
    """
    self.switch = switch
    self.number = number
    self.room = room
    